A BGP (border gateway protocol) is used for transmitting routing information between ASs (autonomous system) and inside an AS. The BGP, as an application layer protocol, runs on a BGP router, and the BGP router stores BGP routing tables, which are an adjacent routing information base-in Adj-RIB-in, an adjacent routing information base-out Adj-RIB-out, and a local routing information base Local-RIB. The BGP maintains one Adj-RIB-in and one Adj-RIB-out for each adjacent BGP. However, the Local-RIB is used for storing routing information that complies with a BGP policy configured for a local device.
After the BGP establishes a session with an adjacency, the BGP router extracts a route from the Local-RIB, performs processing according to an output policy for an adjacent BGP router, puts a route complying with the policy into the Adj-RIB-Out of the BGP router, and sends a route in the Adj-RIB-Out to the adjacent BGP router. The adjacent BGP router puts the received route into the Adj-RIB-In of the adjacent BGP router, so that the BGP makes a decision and performs processing. Currently, the routing information stored in the Local-RIB is mostly selected from the Adj-RIB-in based on a shortest AS-Path (autonomous system-path) attribute policy. From the perspective of user experience, the routing information is not necessarily optimal.